/*
* Copyright (C) 2009-2010 - Roman Kalynchuk
*
* This file is part of REngine.
*
* REngine is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* REngine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with REngine.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __CMOUSE_DEVICE_SDL_H__
#define __CMOUSE_DEVICE_SDL_H__

#include "input/inputtypes.h"
#include "render/irenderdriver.h"
#include "mathlib/vec2.h"
#include "mathlib/vec3.h"
#include "SDL/SDL.h"

namespace rengine3d {

	class CInputSystemSDL;

	class CMouseDeviceSDL: public IMouseDevice {
	public:
		CMouseDeviceSDL(const string_t name, IRenderDriver* renderDriver, CInputSystemSDL* inputSys);
		virtual ~CMouseDeviceSDL();

		virtual bool Init(void);
		virtual void Shutdown(void);

		virtual void Reset(void);

		virtual void Update(void);

		virtual void SetCursorPos(int x, int y) ;

		virtual void SetSensitivity(real value);
		virtual real GetSensitivity(void) const;

		virtual CVec2 GetAbsPosition(void);
		virtual CVec2 GetRelPosition(void);

		virtual bool ButtonIsDown(mouseButton_t button);

		virtual inputDeviceType_t GetType(void) { return inputDeviceType_Mouse; };
		virtual string_t GetName(void)			{ return "CMouseDeviceSDL"; };
	private:
		void Capture(void);
	private:
		real				m_sensitivity;
		CVec2				m_absPosition;
		CVec2				m_relPosition;

		std::vector<bool>	m_buttons;

		IRenderDriver*		m_renderDriver;
		CInputSystemSDL*	m_inputSys;
	};

}

#endif
